<?php
/**
 * 注册、后台注册审核消息通知
 * @author hjc19850430@gmail.com
 */
class RegisterSuccessNoticeMsgtpl extends BaseMsgtpl
{
    /**
     *
     * @param int account_id
     * @param int $noticeUserId 当前用户id 
     * @param int $identity 当前用户身份
     * @param int $type 1，表示审核通过2，表示审核不通过oOwnZtwrlReqnJ2h5mmqTh3LGxmc
     * @param string $reason 审核不通过原因
     */
	public function sendMessage($accountId,$noticeUserId,$identity,$type,$reason)
	{
	    if($identity == 0) {
	        $identity = '学生';
	    } elseif($identity == 1) {
	        $identity = '教职工';
	    } elseif($identity == 2) {
	        $identity = '来宾';
	    }
	    
	    //$url = C('site_url')."/base/User/index";
	    $url = '';
	    $wechatUser = D('Wechat/WechatUser')->getInfo(array('user_id' => $noticeUserId),'openid,subscribe');
		
		if($wechatUser['subscribe']) {
		    
		    if($accountId == 2){       //滨江
		        $this->wxTplSign = 'EL_EUyAr1wEa9RYSW9MgSiaQoIQdEiFQpCwWF7lIVQo';
		    } elseif($accountId == 5) {   // 农林
		        $this->wxTplSign = 'HV-S6hX_OXMaLsNLubOofuaNVTjjLFrKrwv3jkIQ5EY';
		    } elseif($accountId == 6) {   // 农林
		        $this->wxTplSign = 'F2SwLooNv9PcKJmBHcSDvSC_qRJNbQWt5_LoJiWG2Lk';
		    } elseif($accountId == 7) {   // 农林
		        $this->wxTplSign = 'uh7ke98-Tag-GFozvGwaJBXB4aXss08vbhKdpxgh0ww';
		    }
		    
		    $info = array();
		    if($type == 1) {
		        $info = array(
		            'first' => array("value" => '注册审核结果', 'color' => '#173177'),
		            'keyword1' => array("value" => $identity, "color" => "#173177"),
		            'keyword2' => array("value" => '审核通过', "color" => "#173177"),
		            'keyword3' => array("value" => date("Y-m-d H:i:s", time()), "color" => "#173177"),
		        );
		        //$this->wxTplSign = 'hx_u88sEr9QAe0KTu2aoGLowzbfmtbfNH0zAHB28ZOY';
		    }
		    if($type == 2) {
		        $info = array(
		            'first' => array("value" =>'未通过原因:'.$reason,'color' => '#173177'),
		            'keyword1' => array("value" => $identity, "color" => "#173177"),
		            'keyword2' => array("value" => '审核未通过', "color" => "#173177"),
		            'keyword3' => array("value" => date("Y-m-d H:i:s", time()), "color" => "#173177"),
		        );
		        //$this->wxTplSign = '493EIPuzGrqWRRHmCAD_2L1jHGxgcz-jG3t75u8PJxg';
		    }
		    
		    $this->wxObj->messageTpl($this->wechatInfo['appid'], $this->wechatInfo['appsecret'], $wechatUser['openid'], $this->wxTplSign, $info, $url);
		}
		
	}

}
